package com.insist.dao;

import com.insist.entity.OrderDetailInfo;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * Created by Administrator on 2016/7/1.
 */
public interface OrderDetailInfoDao extends JpaRepository<OrderDetailInfo,Long> {
    List<OrderDetailInfo> findByUserId(Long loginUserId);

    List<OrderDetailInfo> findByProductIdAndProductNo(Long productId, String productNo);

    List<OrderDetailInfo> findByUserIdAndOrderId(Long loginUserId, Long orderId);

    @Query("select sum(o.number) from OrderDetailInfo o")
    Integer countTotalJoinNum();

    List<OrderDetailInfo> findByProductId(Long productId);
}
